(define-module (utils os-utils))


(define-public path-join
  (lambda (. parts)
    (let ([parts-no-trailing-slashes
           (map (lambda (part)
                  (string-trim-right part
                                     (lambda (char)
                                       #;(display
                                        (simple-format
                                         #f "checking char: ~a ... will remain? ~a\n"
                                         char
                                         (if (char=? char #\/) "no" "yes")))
                                       (char=? char
                                               (car
                                                (string->list
                                                 file-name-separator-string))))))
                parts)])
      (string-join parts-no-trailing-slashes file-name-separator-string))))
